unit InfEntregador;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ActnList, ComCtrls, ImgList, Grids, DBGrids, DB, DBTables;

type
  TFormInfEntregador = class(TForm)
    ImageList2: TImageList;
    ListView2: TListView;
    ActTotal: TActionList;
    ActionVoltar: TAction;
    DataSource1: TDataSource;
    DBGridEntregador: TDBGrid;
    QueryEntregador: TQuery;
    QueryAtualiza: TQuery;
    procedure ListView2Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure ActionVoltarExecute(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure DataSource1DataChange(Sender: TObject; Field: TField);
    procedure DBGridEntregadorDblClick(Sender: TObject);
  private
    { Private declarations }
    procedure EntregaPedido;
  public
    { Public declarations }
  end;

var
  FormInfEntregador: TFormInfEntregador;
  

implementation

uses Principal;

{$R *.dfm}

procedure TFormInfEntregador.ListView2Click(Sender: TObject);
var List: TListView;
begin
if TListView(Sender).Selected <> nil then
  begin
        List := TlistView(Sender);
        ActTotal.Actions[List.Selected.StateIndex].Execute;
  end;
end;

procedure TFormInfEntregador.FormActivate(Sender: TObject);
begin
QueryEntregador.Open;

DBGridEntregador.SetFocus;
end;

procedure TFormInfEntregador.ActionVoltarExecute(Sender: TObject);
begin
self.Close;
end;

procedure TFormInfEntregador.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if (key = VK_Escape) or (key = VK_Return) then
begin
 
   self.close;

end;



end;

procedure TFormInfEntregador.EntregaPedido;
begin
 FormPrincipal.vIdEntregador := QueryEntregador.FieldByName('id').AsInteger;

end;

procedure TFormInfEntregador.DataSource1DataChange(Sender: TObject;
  Field: TField);
begin
EntregaPedido;
end;

procedure TFormInfEntregador.DBGridEntregadorDblClick(Sender: TObject);
begin
self.Close;
end;

end.
